package cn.admin.configcenter.registry.service;

import cn.admin.remoting.RemotingException;
import cn.admin.remoting.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AbstractServerConnectionFactory {

    private static final Logger LOG = LoggerFactory.getLogger(AbstractServerConnectionFactory.class);
    protected Server server;

    public void start() throws RemotingException {

        server.start();
        LOG.info("Config server is listening on " + this.server.getPort());

    }

    public void stop() throws RemotingException {

        if (server.isStarted()) {
            server.stop();
        }

        LOG.info("Config server is stoped");
    }

}
